import UIKit

let quotation = """
The White Rabbit put on his spectacles.  "Where shall I begin,
please your Majesty?" he asked.

"Begin at the beginning," the King said gravely, "and go on
till you come to the end; then stop."
"""
print(quotation)


let singleLineString = "These are the same."
//多行字符串必须以新一行为起始点
let multilineString = """
These are the same.
"""

//如果你只是想另起一行书写,而不是想在字符串中添加换行效果,
//可以在结尾添加\
//并不会产生在字符串中添加\n的效果
let softWrappedQuotation = """
The White Rabbit put on his spectacles.  "Where shall I begin, \
please your Majesty?" he asked.

"Begin at the beginning," the King said gravely, "and go on \
till you come to the end; then stop."
"""

let lineBreaks = """

This string starts with a line break.
It also ends with a line break.

"""
print("==============1===============")
//多行字符串,以结尾引号缩进处开始对其.
let linesWithIndentation1 = """
    This line doesn't begin with whitespace.
        This line begins with four spaces.
    This line doesn't begin with whitespace.
"""
print(linesWithIndentation1)
print("==============2===============")
let linesWithIndentation2 = """
    This line doesn't begin with whitespace.
        This line begins with four spaces.
    This line doesn't begin with whitespace.
    """
print(linesWithIndentation2)

print("==============特殊字符===============")
// \0 \n \t \r \" \'
let wiseWords = "\"Imagination is more important than knowledge\" - Einstein"
print(wiseWords)
// "Imagination is more important than knowledge" - Einstein
let dollarSign = "\u{24}"        // $,  Unicode scalar U+0024
let blackHeart = "\u{2665}"      // ♥,  Unicode scalar U+2665
let sparklingHeart = "\u{1F496}" // 💖, Unicode scalar U+1F496

print("==============\"\"\"至少带一个\\转义===============")
let threeDoubleQuotationMarks = """
Escaping the first quotation mark \"""
Escaping all three quotation marks \"\"\"
多行字符串使用\"""包裹,字符串中可以带一个"而不用转义,带3个"至少要转义一个"
"""
print(threeDoubleQuotationMarks)

//扩展字符串分隔符:
//字符串使用#包裹
//其中的特殊字符(即转义字符)只会被当成普通字符
//如果需要当成特殊字符,请在特殊字符中使用#分割
print("==============扩展字符串分隔符#===============")
let commonCharactar = #"Line 1\nLine 2"#
print(commonCharactar)
let p1 = #"Line 2\#nLine 3"#
let p2 = ##"Line 000\##nLine 111"## //中间分割#个数要一致
print(p1)
print(p2)


let threeMoreDoubleQuotationMarks = #"""
Here are three more double quotes: """
"""#


//连接字符串和字符
print("==============连接字符串和字符===============")
let badStart = """
    one
    two
    """
let end = """
    three
    """
print(badStart + end)
// Prints two lines:
// one
// twothree


let goodStart = """
    one
    two
    
    """
print(goodStart + end)
// Prints three lines:
// one
// two
// three


//插值
print("==============插值===============")
print(#"Write an interpolated string in Swift using \(multiplier)."#)
// Prints "Write an interpolated string in Swift using \(multiplier)."
print(#"6 times 7 is \#(6 * 7)."#)
// Prints "6 times 7 is 42."


//unicode
"\u{e9}"
"\u{65}"
"\u{301}"



